<!DOCTYPE html>
<html>
<head>
	<title></title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
	<script src="wasm_exec.js"></script>
	<style>
		html {
			height: 100%;
		}
		body {
			margin: 0;
			height: 100%;
		}
	</style>
</head>
<body>
<script>
	const go = new Go();
	// if (WebAssembly.instantiateStreaming) {
	// 	WebAssembly.instantiateStreaming(fetch("main.wasm"), go.importObject).then(run);
	// } else {
	// 	fetch("main.wasm").then(res => {
	// 		return res.arrayBuffer();
	// 	}).then(bytes => {
	// 		return WebAssembly.instantiate(bytes, go.importObject);
	// 	}).then(run);
	// }
	var req = new XMLHttpRequest();
	req.responseType = "arraybuffer";
	req.open("GET", "main.wasm", true);
	req.onreadystatechange = function() {
		if (req.readyState == 4) {
			if (req.status == 200) {
				WebAssembly.instantiate(req.response, go.importObject).then(run);
			}
		}
	};
	req.send();

	function run(res) {
		go.run(res.instance);
		if (window.bridge && bridge.init) {
			bridge.init();
		}
	}
</script>
</body>
</html>